﻿// ***********************************************************************
// Assembly         : OccExample.Commands.Tests
// Author           : TianTeng
// Created          : 2024/4/22 11:43:34
//
// Last Modified By : TianTeng
// Last Modified On : 2024/4/22 11:43:34
// ***********************************************************************
// <copyright file="TextLabelTestCmd.cs" company="">
//     Copyright ©  2024
// </copyright>
// <summary></summary>
// ***********************************************************************
using Occt;
using Tx.OCC.UI.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tx;

namespace OccExample.Commands.Tests
{
    /// <summary>
    /// Class TextLabelTestCmd.
    /// </summary>
    /// <seealso cref="IExtendCommand" />
    [DocOpenedCmdEnable]
    public class TextLabelTestCmd : IExtendCommand
    {
        /// <summary>
        /// Executes the specified command data.
        /// </summary>
        /// <param name="cmdData">The command data.</param>
        /// <param name="message">The message.</param>
        /// <returns>CmdResult.</returns>
        public CmdResult Execute(ExtendCmdData cmdData, ref string message)
        {
            var occtView = (cmdData.ViewWindow as IViewWindow).View as OcctView;

            var text = new AIS_TextLabel();
            text.Font = new TCollection_AsciiString("Arial");
            text.SetZoomable(true);
            text.HasFlipping = true;
            text.SetColor(new Quantity_Color(Quantity_NameOfColor.Quantity_NOC_BLACK));
            text.Text = new TCollection_ExtendedString("GB-2020");
            text.SetHeight(20);
            //text.SetAngle(mark.Rotate);
            text.SetHJustification(Graphic3d_HorizontalTextAlignment.Graphic3d_HTA_CENTER);
            text.Orientation3D = new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0.0, 0.0, 1.0), new gp_Dir(1.0, 0.0, 0.0));
            //text.UnsetOrientation3D();
            //text.Position = new gp_Pnt(0, 0, 0);
            occtView.Viwer.Viewer.View.Context.Display(text, true);
            return CmdResult.Succeed;
        }
    }
}
